﻿@using SH = EMoney.IStock.Client.Framework.StringHelper;
@using EMoney.IStock.Client.Models.QQ;
@{
    Layout = null;
    List<TB_FocusStock> thLst = (List<TB_FocusStock>)ViewBag.thLst;
    List<TB_FocusStock> ysLst = (List<TB_FocusStock>)ViewBag.ysLst;
    List<TB_FocusBlock> bLst = (List<TB_FocusBlock>)ViewBag.bLst;
    string codes = "";
    string qqState=ViewBag.QQState+"";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>腾讯大赛</title>
    <link href="@SH.GetStaticFile("IStockClientStatic/jrpt/css/black.css?v=1")" rel="stylesheet" type="text/css" />
    <script src="http://static.emoney.cn/js/libs/jquery.min.1.8.3.js" type="text/javascript"></script>
    <script src="@SH.GetStaticFile("IStockClientStatic/jrpt/js/EMWEBUIscrollBar.js")" type="text/javascript"></script>
    <script src="@SH.GetStaticFile("IStockClientStatic/jrpt/js/jrptcom.js?v=1")" type="text/javascript"></script>
</head>
<body>
<div class="main">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td align="left" valign="top" style="padding-right:17px;">
          <div class="tab_box_left">
          <div class="tab_1" id="rankMenu"><a href="javascript:;" class="on">总排名</a><a href="javascript:;">周排名</a><a href="javascript:;">日排名</a></div>
          <div class="rank_k">
              <div class="rank_top">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <th width="10%" align="center" valign="middle" style="color:#aaa;"><span>排名</span></th>
                    <th width="15%" align="center" valign="middle" style="color:#aaa;"><span>高手名称</span></th>
                    <th width="15%" align="center" valign="middle" style="color:#aaa;"><span>总收益率%</span></th>
                    <th width="15%" align="center" valign="middle" style="color:#aaa;"><span>总资产</span></th>
                    <th width="15%" align="center" valign="middle" style="color:#aaa;"><span>仓位%</span></th>
                    <th width="15%" align="center" valign="middle" style="color:#aaa;"><span>周收益率%</span></th>
                    <th width="15%" align="center" valign="middle" style="color:#aaa;"><span>日收益率%</span></th>
                  </tr>
                </table>
              </div>
              <div class="rank_list">
                  <div id="scrollBox03" scrollflag class="scrollBox rank_list02" style=" height:561px;overflow:hidden;">
                      @Html.Partial("rank")
                  </div>
              </div>
            </div>
          </div>
        </td>
        <td width="273" align="left" valign="top">
            <div class="main_right">
                <div class="main_right_title"><em>高手聚焦</em><a id="QQState1" target="_blank" href="http://www.emoney.cn" style="display:@(qqState=="1"?";":"none;")"><img src="@SH.GetStaticFile("IStockClientStatic/jrpt/images/baoming1.png")" /></a><a id="QQState" style="display:@(qqState=="1"?"none;":";")" href="javascript:;" onclick="return JRPTRegister();"><img src="@SH.GetStaticFile("IStockClientStatic/jrpt/images/baoming.jpg")" /></a></div>
                <div class="tab_1_top">
                    <table style="width:100%;" border="0" cellspacing="0" cellpadding="0">
                        <tr>@if (bLst != null && bLst.Count > 0)
                            {
                                for (var i = 0; i < bLst.Count; i++)
                                {
                                    var mo=bLst[i];
                                    
                          <td align="center"><div class="tab_1_top_font" style="cursor:pointer;">
                              <table width="100%" border="0" cellspacing="0" cellpadding="0" ondblclick="GoBKLine('@mo.BlockCode');">
                                <tr>
                                  <td>@mo.BlockName</td>
                                </tr>
                              </table>
                            </div></td>
                                }
                            }
                            else{
                                <td>--无记录--</td>
                            }
                        </tr>
                    </table>
                </div>
                <div class="data_box" style="overflow: hidden;">
                    <div id="scrollBox2" class="scrollBox" scrollflag style="height: 270px;">
                        <div style="padding-right: 10px;">
                            <div class="data_new">
                                <h3 class="data_new_title"><em>当日聚焦</em></h3>
                                @if(thLst!=null&&thLst.Count>0)
                                {
                                    for(var i=0;i<thLst.Count;i++)
                                    {
                                        var mo=thLst[i];
                                        var stock=mo.SecuCode;
                                        if (stock.Length == 6)
                                        {
                                            if (Convert.ToInt32(stock) < 600000)
                                            {
                                                stock = "1" + stock;
                                            }
                                        }
                                        codes += "{|*" + stock + "*|}";
                                <div class="data_new_list">
                                    <div class="p1" onclick="GoKLine('@mo.SecuCode');">
                                        <p class="yellow">@mo.SecuName</p>
                                        <p class="blue">@mo.SecuCode</p>
                                    </div>
                                    <div class="p2" name="@(mo.SecuCode)P"><span class="">--</span></div>
                                    <div class="p2" name="@(mo.SecuCode)F"><span class="">--</span></div>
                                    <div class="data_new_prompt">
                                        <span class="data_new_prompt_font">有@(mo.Number)名高手买入平均成本@(SH.FormatDecimal(mo.AvgPrice))</span>
                                        <span class="data_new_prompt_right"><img src="images/data_new_prompt_bg.png" /></span>

                                    </div>
                                    <div class="clear"></div>
                                </div>
                                }
                                }
                                else{
                                    <div style="text-align:center;">--无记录--</div>
                                }
                            </div>
                            <div class="data_new">
                                <h3><em>昨日聚焦</em></h3>
                                @if (ysLst != null && ysLst.Count > 0)
                                {
                                    for (var i = 0; i < ysLst.Count; i++)
                                    {
                                        var mo = ysLst[i];
                                        var stock = mo.SecuCode;
                                        if (stock.Length == 6)
                                        {
                                            if (Convert.ToInt32(stock) < 600000)
                                            {
                                                stock = "1" + stock;
                                            }
                                        }
                                        codes += "{|*" + stock + "*|}";
                                <div class="data_new_list">
                                    <div class="p1" onclick="GoKLine('@mo.SecuCode');">
                                        <p class="yellow">@mo.SecuName</p>
                                        <p class="blue">@mo.SecuCode</p>
                                    </div>
                                    <div class="p2" name="@(mo.SecuCode)P"><span class="">--</span></div>
                                    <div class="p2" name="@(mo.SecuCode)F"><span class="">--</span></div>
                                    <div class="data_new_prompt">
                                        <span class="data_new_prompt_font">有@(mo.Number)名高手买入平均成本@(SH.FormatDecimal(mo.AvgPrice))</span>
                                        <span class="data_new_prompt_right"><img src="images/data_new_prompt_bg.png" /></span>

                                    </div>
                                    <div class="clear"></div>
                                </div>
                                    }
                                }else{
                                    <div style="text-align:center;">--无记录--</div>
                                }
                            </div>
                        </div>
                    </div>
                </div>
          </div>  
        </td>
    </tr>
  </table>
</div>
<div id="loadingDocument" style='display:none;text-align:center;background-color: #222222; filter: alpha(opacity=50);opacity:0.5; width:100%; height:400px; position: absolute; top:0px; left:0px;z-index:100;'></div>
<!--wcp_box-->
<div class="wcp_box" style="display:none;" id="wcp_box">
 <div class="wcp_box_title">
  <strong>高手揭秘</strong>
  <span class="guanbi" onClick="$('div#layer').remove();$('#wcp_box').hide();$('#loadingDocument').hide();"></span>
  </div>
  <div class="wcp_main">
  <!--wcp_left-->
  <div class="wcp_left" id="uncover_left">
  </div>
  <!--wcp_left end-->
  <!--wcp_right-->
  <div class="wcp_right">
      <div class="wcp_right_top" id="boxMenu"><a href="javascript:;" class="on">持仓列表</a></div>
      <div class="wcp_right_box">
        <div class="wcp_right_box_A">
           <div class="wcp_right_box_top">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <th width="13%" align="center" valign="middle">名称</th>
                    <th width="10%" align="center" valign="middle">代码</th>
                    <th width="10%" align="center" valign="middle">最新</th>
                    <th width="11%" align="center" valign="middle">涨幅%</th>
                    <th width="13%" align="center" valign="middle">持股数</th>
                    <th width="13%" align="center" valign="middle">成本价</th>
                    <th width="15%" align="center" valign="middle">持仓市值</th>
                    <th width="15%" align="center" valign="middle">浮动盈亏</th>
                  </tr>
                </table>
              </div>
           <div class="wcp_right_box_list">
               <div class="scrollBox" style="height:216px; overflow:hidden;" id="myChiCangList"></div>
           </div>
        </div>
      </div>
  </div>
  <!--wcp_right end-->
  </div>
</div>
<!--wcp_box end-->
 <div class="guidetitle" style="display:none;" id="registerBox">
    <h3>2014腾讯A股大赛，千万实盘铸就最牛操盘手<span onclick="RegisterColse();">X</span></h3>
    <div class="guide_box">
        <iframe id="registerIframe" src="" style="width:100%;height:100%;"></iframe>
    </div>
</div>
    
<input id="SortName" type="hidden" value="" />
<input id="SortFlag" type="hidden" value="" />
<input type="hidden" id="hidSecuCodeList" value="@codes" />
<input type="hidden" id="hidToken" value="@ViewBag.Token" />
<input type="hidden" id="hidRankType" value="0" />
<input type="hidden" id="hidQQState" value="@qqState" />
<script type="text/javascript">
    var www = "@Url.Content("~/")", token = $("#hidToken").val() + "";
    //计算页面大小
    function rize() {
        //var hh = document.documentElement.clientHeight;
        //var xx = hh - 16;
        //$("body").css("height", hh);
        //$("#loadingDocument").css("height", hh);
        //$(".main").css("height", (hh - 16));
        //$(".tab_box_left").css("height", (hh - 18));
        //$(".main_left").css("height", (hh - 16));
        //$(".main_right").css("height", (hh - 16));
        //$(".rank_k").css("height", (xx - 45));
        //$(".rank_list").css("height", (xx - 80));
        //$("#scrollBox03").css("height", (xx - 80));
        //var data_box = xx - 150;
        //$(".data_box").css("height", data_box);
        //$("#scrollBox2").css("height", data_box);
        //$(".scrollBox").jscroll({ W: "8px", IW: "8px", CurrT: 0, Bar: { Pos: "up" }, Btn: { btn: false }, Fn: function () { } });
        //ReSetScroll();
    };

    var vx = {
        throttleTimeout: null,
        CommonScroll: function () {
            var hh = document.documentElement.clientHeight;
            var xx = hh - 16;
            $("body").css("height", hh);
            $("#loadingDocument").css("height", hh);
            $(".main").css("height", (hh - 16));
            $(".tab_box_left").css("height", (hh - 18));
            $(".main_left").css("height", (hh - 16));
            $(".main_right").css("height", (hh - 16));
            $(".rank_k").css("height", (xx - 80));
            $(".rank_list").css("height", (xx - 80));
            $("#scrollBox03").css("height", (xx - 80));
            var data_box = xx - 150;
            $(".data_box").css("height", data_box);
            $("#scrollBox2").css("height", data_box);
            $(".scrollBox").jscroll({ W: "8px", IW: "8px", CurrT: 0, Bar: { Pos: "up" }, Btn: { btn: false }, Fn: function () { } });
            ReSetScroll();
        },
        appi: function () {
            $(document).queue(function () {
                $(this).clearQueue();
                //start ……
                vx.CommonScroll();
                //end……
                $(this).dequeue();
            });
        }
    };

    //监控窗口resize
    $(window).resize(function () {
        if ($.browser.msie) {
            if (!vx.throttleTimeout) {
                vx.throttleTimeout = setTimeout(
                    function () {
                        vx.appi();
                        vx.throttleTimeout = null;
                    }, 50
                );
            }
        } else {
            vx.appi();
        }
    });

    $(document).ready(function () {
        vx.appi();

        EM_FUNC_DOWNLOAD_COMPLETE();

        LoadSecuInfo();
        //排行榜切换
        $("#rankMenu a").click(function () {
            $(this).addClass('on').siblings().removeClass('on');
            var index = $(this).index();
            $("#hidRankType").val(index);
            fenye(1);
            return false;
        });
    });

    var delayq1;
    //延迟刷新，5秒执行一次
    function DelayRefresh() {
        if (delayq1 != null) {
            clearInterval(delayq1);
        }

        delayq1 = setInterval(function () {
            try {
                DisplayPrice();
            } catch (e) { }
        },5000);
    }

    //读取个股行情
    function LoadSecuInfo() {
        var goods = $("#hidSecuCodeList").val() + "";//{|*600000*|}{|*600001*|}
        if (goods != "") {
            EM_FUNC_AGEVENT_GETGOODS(goods);
            DisplayPrice();
            DelayRefresh();
        }
    }

    //获取行情数据显示
    function DisplayPrice() {
        var data = EM_FUNC_AGEVENT_PUSHDATA();
        //data = "{\"data\":[{\"code\":\"600000\",\"p\":\"13.72\",\"zdf\":\"-5.8%\"},{\"code\":\"000002\",\"p\":\"14.72\",\"zdf\":\"4.4%\"}],\"ver\":1}";
        if (data!=null&&data!=undefined&&data != "") {
            var jsData = eval("(" + data + ")");
            if (jsData.data != null && jsData.data.length > 0) {
                for(var i=0;i<jsData.data.length;i++)
                {
                    var re = jsData.data[i];
                    if (re.p != "" && re.p != "0"&&re.p!="0.00") {
                        var p = "<span class=\"" + (re.zdf.indexOf('-') == 0 ? "green" : "red") + "\">" + re.p + "</span>";
                        var f = "<span class=\"" + (re.zdf.indexOf('-') == 0 ? "green" : "red") + "\">" + re.zdf + "</span>";
                        $("#scrollBox2 [name=" + re.code + "P]").html(p);
                        $("#scrollBox2 [name=" + re.code + "F]").html(f);
                    }
                }
            }
        }
    }

    //分页
    function fenye(index) {
        var saveCol = $("#SortName").val();
        var sortFlag = $("#SortFlag").val();
        var type=$("#hidRankType").val();
        $.ajax({
            type: "POST",
            url: www + "focus/rank?" + token,
            data: {index:index,SortName: saveCol, SortFlag: sortFlag, type: type },
            dataType: "text",
            success: function (data) {
                $("#scrollBox03").html(data);
                $(".scrollBox").jscroll({ W: "8px", IW: "8px", CurrT: 0, Bar: { Pos: "up" }, Btn: { btn: false }, Fn: function () { } });
                return false;
            },
            beforeSend: function () {
                LoadingDocument($("#scrollBox03"));
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                //alert(XMLHttpRequest.status);
            }
        });
        return false;
    };

    //排序
    function Sort(col) {
        var saveCol = $("#SortName").val();
        var sortFlag = $("#SortFlag").val();
        if (saveCol == col) {
            if (sortFlag == "") {
                sortFlag = "desc";
            }
            else {
                sortFlag = "";
            }
        }
        else {
            sortFlag = "";
        }
        $("#SortFlag").val(sortFlag);
        $("#SortName").val(col);
        fenye(1);
        return false;
    };

    //高手揭秘
    function ShowGSJM(_qq,_nickName) {
        //获取高手揭秘左侧信息
        $.ajax({
            type: "POST",
            url: www + "focus/rank_gsjm_left?" + token,
            data: { qq: _qq, nickname: _nickName },
            dataType: "text",
            success: function (data) {
                $("#uncover_left").html(data);
            },
            beforeSend: function () {
                LoadingDocument($("#uncover_left"));
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                //alert(XMLHttpRequest.status);
            }
        });

        //获取高手揭秘持仓列表
        $.ajax({
            type: "POST",
            url: www + "focus/rank_gsjm?" + token,
            data: { qq: _qq, nickname: _nickName },
            dataType: "text",
            success: function (data) {
                $("#myChiCangList").html(data);
                $(".scrollBox").jscroll({ W: "8px", IW: "8px", CurrT: 0, Bar: { Pos: "up" }, Btn: { btn: false }, Fn: function () { } });
            },
            beforeSend: function () {
                LoadingDocument($("#myChiCangList"));
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                //alert(XMLHttpRequest.status);
            }
        });

        $("#loadingDocument").show();
        $("#wcp_box").show();
    }

    //报名参赛
    function JRPTRegister() {
        var qState = $("#hidQQState").val();
        if (qState != "1") {
            $("#registerIframe").attr("src", www + "Focus/JRPTRegister?" + token);
            $("#loadingDocument").show();
            $("#registerBox").show();
        }
    }

    //关闭报名
    function RegisterColse() {
        var state = "0";
        try{
            state=$("#registerIframe").contents().find("#hidRegisterState").val();
        }
        catch (e) { state="0"}
        if (state == "1") {
            $("#QQState1").show();
            $("#QQState").hide();
            $("#hidQQState").val("1");
        }
        $("#loadingDocument").hide();
        $("#registerBox").hide();
    }

</script>
</body>
</html>
